home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 March
/
PCWorld_2008-03_cd.bin
/
v cisle
/
mediacoder
/
MediaCoder-0.6.1.4045.exe
/
extensions
/
AudioRipper.7z
/
extension.xsl
< prev
Wrap
Extensible Markup Language
|
2007-02-27
|
10KB
|
292 lines
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<!--Include extension shared xsl-->
<xsl:include href="../_include/extbase.xsl"/>
<xsl:template match="/extension">
<html>
<head>
<title>MediaCoder <xsl:value-of select="name"/></title>
<link href="default.css" rel="stylesheet" type="text/css" />
<xsl:call-template name="InitExtension"/>
<script language="javascript">
var rate_mode = "VBR";
var target = "Lossy Formats";
function onElementChange(id,value)
{
switch (id) {
case "rate_mode":
rate_mode = value;
if (value == "VBR") {
ShowItem("li_quality");
HideItem("li_bitrate");
} else {
HideItem("li_quality");
ShowItem("li_bitrate");
}
break;
case "target":
target = value;
switch (value) {
case "Lossy Formats":
HideItem("li_lossless");
ShowItem("li_lossy");
ShowItem("li_speed");
onElementChange("rate_mode", rate_mode);
onElementChange("lossy_formats", ValueOf("lossy_formats"));
break;
case "Lossless Formats":
HideItem("li_lossy");
ShowItem("li_lossless");
HideItem("li_quality");
HideItem("li_bitrate");
ShowItem("li_speed");
onElementChange("lossless_formats", ValueOf("lossless_formats"));
break;
case "Stream Copy":
HideItem("li_lossy");
HideItem("li_lossless");
HideItem("li_quality");
HideItem("li_bitrate");
HideItem("li_speed");
break;
}
break;
case "lossy_formats":
var fmt;
var profile = null;
switch (value) {
case "MP3":
fmt = "LAME MP3";
break;
case "Vorbis":
fmt = "Vorbis";
break;
case "LC-AAC":
if (!profile) profile = "LC-AAC";
case "HE-AAC":
if (!profile) profile = "HE-AAC";
case "HE-AAC V2":
if (!profile) profile = "HE-AAC V2";
fmt = "Nero Encoder";
SetPrefValue("audioenc.nero.format", profile);
break;
}
SetPrefValue("overall.audio.encoder", fmt);
SetBitrate(null);
SetSpeed();
break;
case "lossless_formats":
var fmt = value;
switch (value) {
case "Monkey's Audio (APE)":
fmt = "APE"
break;
}
SetPrefValue("overall.audio.encoder", fmt);
SetSpeed();
break;
case "speed":
SetSpeed();
break;
}
}
function element(id)
{
var e = document.getElementById(id);
if (e) return e;
alert("Element " + id + " not found");
return null;
}
function SetBitrate(value)
{
switch (ValueOf("lossy_formats")) {
case "MP3":
if (!value) {
value = "128";
element("bitrate").value = value;
}
SetPrefValue("audioenc.lame.bitrate", value);
break;
case "Vorbis":
if (!value) {
value = "112";
element("bitrate").value = value;
}
SetPrefValue("audioenc.vorbis.bitrate", value);
break;
case "LC-AAC":
if (!value) {
value = "112";
element("bitrate").value = value;
}
SetPrefValue("audioenc.nero.bitrate", value);
break;
case "HE-AAC":
if (!value) {
value = "64";
element("bitrate").value = value;
}
SetPrefValue("audioenc.nero.bitrate", value);
break;
case "HE-AAC V2":
if (!value) value = "48";
element("bitrate").value = value;
SetPrefValue("audioenc.nero.bitrate", value);
break;
}
}
function SetSpeed()
{
var speed = ValueOf("speed");
var fmt;
var info = "";
var map;
if (target == "Stream Copy")
fmt = "";
else
fmt = ValueOf(target == "Lossy Formats" ? "lossy_formats" : "lossless_formats");
switch (fmt) {
case "MP3":
map = new Array(0,2,4,6,9);
SetPrefValue("audioenc.lame.aq", map[speed]);
info = "LAME algorithm quality = " + map[speed];
break;
case "FLAC":
map = new Array(8,8,6,3,0);
SetPrefValue("audioenc.flac.level", map[speed]);
info = "FLAC compression level = " + map[speed];
if (speed == 0) {
SetPrefValue("audioenc.flac.exhaustive", "true");
info += ", exhaustive search enabled";
} else {
SetPrefValue("audioenc.flac.exhaustive", "false");
}
break;
case "WavPack":
map = new Array(6,5,4,2,0);
SetPrefValue("audioenc.wavpack.extra", map[speed]);
info = "Extra encode processing = " + map[speed];
if (speed == 0 || speed == 1 || speed == 2) {
SetPrefValue("audioenc.wavpack.best", "true");
info += ", best compression mode enabled";
} else {
SetPrefValue("audioenc.wavpack.best", "false");
}
break;
case "Monkey's Audio (APE)":
map = new Array("Insane","Extra High","High","Normal","Fast");
SetPrefValue("audioenc.ape.level", map[speed]);
info = "APE compression level = " + map[speed];
break;
default:
info = "No speed/quality trade-off option for this format";
}
element("speed_info").innerHTML = info;
}
function onLoad()
{
SetBitrate(null);
SetSpeed();
}
</script>
</head>
<body class="box1" onLoad="onLoad()">
<h2 align="center">MediaCoder <xsl:value-of select="name"/></h2>
<hr /><strong>Settings </strong><br />
<div style="border:solid">
<ul>
<li>
Target:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='target']"/>
<xsl:with-param name="option" select="elements/element[@id='target']/option[1]"/>
</xsl:call-template>
(<a href="javascript:OpenURL('http://mediacoder.sourceforge.net/wiki/index.php?title=Lossy_data_compression')"><strong>?</strong></a>)
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='target']"/>
<xsl:with-param name="option" select="elements/element[@id='target']/option[2]"/>
</xsl:call-template>
(<a href="javascript:OpenURL('http://mediacoder.sourceforge.net/wiki/index.php?title=Lossless_data_compression')"><strong>?</strong></a>)
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='target']"/>
<xsl:with-param name="option" select="elements/element[@id='target']/option[3]"/>
</xsl:call-template>
</li>
<li id="li_lossy">Format:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='lossy_formats']"/>
</xsl:call-template>
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='rate_mode']"/>
<xsl:with-param name="option" select="elements/element[@id='rate_mode']/option[1]"/>
</xsl:call-template>
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='rate_mode']"/>
<xsl:with-param name="option" select="elements/element[@id='rate_mode']/option[2]"/>
</xsl:call-template>
</li>
<li id="li_lossless" style="display:none">Format:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='lossless_formats']"/>
</xsl:call-template>
</li>
<li id="li_quality">
Quality:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='quality']"/>
</xsl:call-template>
</li>
<li id="li_bitrate" style="display:none">
Bitrate:
<input type="text" size="4" value="128" id="bitrate" onkeyup="SetBitrate(value)"/> KBps
</li>
<li id="li_speed">
Speed/Quality Trade-off:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='speed']"/>
</xsl:call-template>
<br /><div id="speed_info" style="font-style:italic"></div>
</li>
</ul>
</div>
<strong> Filtering </strong>
<div style="border:solid">
<ul>
<li>Channels:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='channels']"/>
</xsl:call-template>
</li>
<li>Resampling:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='resample']"/>
</xsl:call-template>
</li>
<li>Volume Gain:
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='gain']"/>
</xsl:call-template>
</li>
<li>
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='normalize']"/>
</xsl:call-template>
<xsl:call-template name="AddElement">
<xsl:with-param name="element" select="elements/element[@id='extra_stereo']"/>
</xsl:call-template>
</li>
</ul>
</div>
<div align="center">
<p>
<input name="button" type="button" onclick="SendCommand('preview')" value="Play Original"/>
<input name="button" type="button" onclick="SendCommand('preview')" value="Play Encoded"/>
<input name="button" type="button" onclick="SendCommand('transcode')" value="Start Encoding"/>
</p>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>